//
//  XXCategoryViewController.m
//  XX
//
//  Created by lly on 15/5/26.
//  Copyright (c) 2015年 lly. All rights reserved.
//

#import "XXCategoryViewController.h"

@interface XXCategoryViewController ()
@property (nonatomic, strong) NSMutableArray *categoriesArray;
@end

@implementation XXCategoryViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _categoriesArray = [[NSMutableArray alloc] init];
    NSDictionary *dict1 = @{@"image":@"cate1.png",@"name":@"香蕉"};
    [_categoriesArray addObject:dict1];
    NSDictionary *dict2 = @{@"image":@"cate1.png",@"name":@"香蕉"};
    [_categoriesArray addObject:dict2];
    NSDictionary *dict3 = @{@"image":@"cate1.png",@"name":@"香蕉"};
    [_categoriesArray addObject:dict3];
    NSDictionary *dict4 = @{@"image":@"cate1.png",@"name":@"香蕉"};
    [_categoriesArray addObject:dict4];
    NSDictionary *dict5 = @{@"image":@"cate1.png",@"name":@"香蕉"};
    [_categoriesArray addObject:dict5];
    NSDictionary *dict6 = @{@"image":@"cate1.png",@"name":@"香蕉"};
    [_categoriesArray addObject:dict6];
    NSDictionary *dict7 = @{@"image":@"cate1.png",@"name":@"香蕉"};
    [_categoriesArray addObject:dict7];
    NSDictionary *dict8 = @{@"image":@"cate1.png",@"name":@"香蕉"};
    [_categoriesArray addObject:dict8];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.categoriesArray.count;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellIndentifier = @"categoryCell";
    UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:cellIndentifier];
    
    if(!cell)
    {
        cell =  [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIndentifier];
    }
    NSDictionary *dic = self.categoriesArray[indexPath.row];
    cell.imageView.image = [UIImage imageNamed:dic[@"image"]];
    cell.textLabel.text = dic[@"name"];
    return cell;
}
#pragma mark UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 44;
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
